package com.entrogy.service;

import com.alibaba.fastjson.JSONObject;
import com.entrogy.bean.StudentBasicInfoEntity;
import com.entrogy.bean.StudentEntity;
import com.entrogy.bean.StudentIcEntity;

import java.util.List;
import java.util.Map;

/**
 *  学生信息service 接口
 */
public interface StudentService {
	/**
	 * 根据条件 获取所有学生的总记录条数
	 * @param map
	 * @return
	 */
	List<Map<String,Object>> getTotalStudentList(Map<String,Object> map);

	/**
	 *  分页条件查询学生信息  获取总条数
	 * @param map
	 * @return
	 */
	int getTotal(Map<String,Object> map);
	/**
	 * 新增学生
	 *
	 * @param studentEntity
	 * @return
	 */
	int insertStudent(StudentEntity studentEntity);

	/**
	 * 修改学生信息
	 * @param  studentEntity
	 * @return
	 */
	int  updateStudent(StudentEntity studentEntity);
	/**
	 *   修改父母id
	 * @param map
	 * @return
	 */
	int  updateStuent1(Map<String,Object> map);
	/**
	 *  根据id 查询学生信息
	 * @param id
	 * @return
	 */
	StudentEntity getStudentById( int id);

	/**
	 * 根据年级ID查询出所在年级的所有学生信息
	 * @param courseId
	 * @param schoolCode
     * @return
	 */
	List<StudentEntity> getStudentByGrade(String courseId, Integer schoolCode);

	/**
	 * 德育处更新学生通行的时间段
	 * @param studentIDs
	 * @param allowTimes
	 * @return
	 */
	int updateStudentControl(String studentIDs, String allowTimes);

	/**
	 * 班主任或家长设置学生的离校状态
	 * @param userId
	 * @param studentIDs
	 * @param leaveTypes
	 * @return
	 */
	int updateStudentSetUp(String userId, String studentIDs, String leaveTypes);

	/**
	 * 根据父母id查询出子女的id
	 * @param uId
	 * @return
	 */
	List<Integer> findStuIdsByParentId(String uId);

	/**
	 * 根据学生id得到班级id
	 * @param stuId
	 * @return
	 */
    Integer findClassIdByStuId(Integer stuId);

	/**
	 * 家长设置其孩子当时离校
	 * @param uid
	 * @param stuId
	 * @return
	 */
    int setStudentGoHome(String uid, String stuId);

	/**
	 * 根据学校id以及班级id查看某个学生是否存在
	 * @param schoolCode
	 * @param classId
	 * @param studentName
	 * @return
	 */
    Integer findStudentBySchoolCodeAndClassId(Integer schoolCode, Integer classId, String studentName);

	/**
	 * 班主任查看该班所有学生以及家长信息变更状态
	 * @param uid
	 * @param showImage
	 * @return
	 */
	List<JSONObject> listStudentAndInformationStatus(String uid, String showImage);

	Integer getStudentIdByParentIdAndTeacherId(String uid, String teacherId);

	List<Integer> getStudentId(String studentName, Integer classId, Integer schoolCode);

    List<JSONObject> listFloorStudent(Integer gradeId, Integer classId, Integer schoolCode);

    List<StudentEntity> listSchoolAllStudent(Integer schoolCode, Integer gradeId, Integer classId, Integer studentId, String studentName, String icNumber, String allowTime);

	boolean updateStudentThdid(Integer studentId, int thdId);

	Integer getStudentSchoolCode(Integer studentId);

	List<StudentEntity> listStudentByClassId(String classId, Integer schoolCode);

    List<StudentEntity> batchInsertParentByPhone(Integer schoolCode, Integer gradeId, Integer classId, Integer studentId);

	List<StudentEntity> allotStudentDorm(Integer schoolCode, Integer gradeId, Integer classId, Integer studentId);

	List<StudentEntity> initStudentData(Integer schoolCode, Integer gradeId, Integer classId, Integer studentId);

    boolean deleteStudent(Integer schoolCode, Integer gradeId, Integer classId, Integer studentId);

    List<StudentEntity> listSchoolStudent();

    Integer getStudentCycleId(int id, String cycleTableName);

    boolean updateStudentInfo(Integer studentId, String studentPhotoUrl);

	boolean studentIsPay(int id);

	/**
	 * 用于IC卡管理界面的学生信息查询
	 * @param schoolCode
	 * @param isBind
	 * @param gradeId
	 * @param classId
	 * @param studentName
	 * @return
	 */
    List<StudentIcEntity> listStudentForIcManager(Integer schoolCode, Integer isBind, Integer gradeId, Integer classId, String studentName);

	/**
	 * 用于IC卡管理界面的学生人数统计
	 * @param schoolCode
	 * @param isBind
	 * @param gradeId
	 * @param classId
	 * @param studentName
	 * @return
	 */
	int countStudentForIcManager(Integer schoolCode, Integer isBind, Integer gradeId, Integer classId, String studentName);

	/**
	 * 查询属于该线路的的学生
	 * @param busLineId
	 * @param studentName
	 * @param schoolCode
	 * @return
	 */
	List<StudentBasicInfoEntity> listStudentForBus(Integer busLineId, String studentName, Integer schoolCode);

	/**
	 * 查询属于该线路的的学生人数
	 * @param busLineId
	 * @param studentName
	 * @param schoolCode
	 * @return
	 */
	Integer countStudentForBus(Integer busLineId, String studentName, Integer schoolCode);

	/**
	 * 更新所有的实义德后台id
	 * @param studentId
	 * @param thdidInfo
	 * @return
	 */
	boolean updateStudentAllThdid(Integer studentId, Map<String, Integer> thdidInfo);

	/**
	 * 统计学生数量
	 * @param schoolCode
	 * @return
	 */
    int countStudent(Integer schoolCode, Integer gradeId, Integer courseId, String studentName);
}
